package com.qing.design.patterns.observer.example;

import com.qing.design.patterns.observer.example.editor.Editor;
import com.qing.design.patterns.observer.example.listeners.EmailNotificationListener;
import com.qing.design.patterns.observer.example.listeners.LogOpenListener;

public class Demo {
    public static void main(String[] args) throws Exception {
        Editor editor=new Editor();
        editor.events.subscribe("open",new LogOpenListener("/test.txt"));
        editor.events.subscribe("save",new EmailNotificationListener("qing@126.com"));


        editor.openFile("test2.txt");
//        editor.saveFile();

    }
}
